<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="navbar.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'new_file.jsp' starting page</title>
	<link rel="stylesheet" type="text/css" href="styles/css/bootstrap.min.css" />
  </head>
  
  <body class="body">
    <div class="container" style="margin-top:60px;width:960px;margin-left:auto;margin-right:auto;">
	  <div class="row">
	
	
	    <!-- 导入左侧部分 -->
		<jsp:include page="side.jsp">
			<jsp:param value="file" name="tag"/>
		</jsp:include>
		
		
		<div class="span9">
	<form class="form-horizontal" action="file.jspx?m=upload&id=${requestScope.folder.folderId }" method="post" id="myform"  enctype="multipart/form-data">
        <fieldset>
          <legend>分享新文件</legend>
          <div class="control-group">

            <label class="control-label" for="input01">文件名称</label>
            <div class="controls">
              <input style="height:28px;" type="text" class="span5" id="fileName" name="name" x-webkit-speech="undefined" />
            </div>
          </div>
		  <div class="control-group">
            <label class="control-label" for="input01"></label>
            <div class="controls">

              <input type="file" name="name" class="span5" id="input01" x-webkit-speech="undefined" />
            </div>
          </div>

          <div class="form-actions">
            <button type="button" class="btn btn-primary" id="btnSubmit">保存</button>
            <a href="file.jspx?m=file&id=${requestScope.folder.folderId }" class="btn">返回</a>
          </div>

        </fieldset>
     </form>          
          	
		</div>
		<div class="span3">
			
		</div>
	  </div>
	</div>
	
	
	
	
	<script type="text/javascript" src="styles/jquery/jquery.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#btnSubmit").click(function(){
				var fileName = $("#fileName").val();
				if(fileName.trim().length == 0){
					$("#span1").html("文件名称不能为空！");
					$("#fileName").focus();
					return;
				} else if(fileName.length > 10){
					$("#span1").html("文件名称长度不能大于10");
					$("#fileName").focus();
					return;										
				}
				
				
				$("#myform").submit();
			});
		});
	</script>
  </body>
</html>
